package com.rykj.qxj.test.fileApi;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.commons.text.StrSubstitutor;

public class FileApi {

	public static void main(String[] args) {
		
		Map<String, String> replaceValue =new HashMap<String, String>();
	    replaceValue.put("name", "john");
	    replaceValue.put("age", "27");
	    StrSubstitutor strSubstitutor = new StrSubstitutor(replaceValue);
	    String template1 = "${name} is at the age of ${age}";
	    String param3 = strSubstitutor.replace(template1);
	    System.out.println("-------------------param3=" + param3);
	    System.out.println("=======================================");
	    

		Map valuesMap = new HashMap();
		valuesMap.put("animal", "quick brown fox");
		valuesMap.put("target", "lazy dog");
		String templateString = "The ${animal} jumped over the ${target}.";
		StrSubstitutor sub = new StrSubstitutor(valuesMap);
		String resolvedString = sub.replace(templateString);
		System.out.println(resolvedString);
		
		System.out.println("测试地址开始==========");
		Map<String,String> urlValuesMap=new HashMap<String,String>();
		urlValuesMap.put("date", "20190724");
		urlValuesMap.put("fileDate", "20190724000");
		urlValuesMap.put("hight", "6000m");
		
		String url="http://szidc.oss-cn-shenzhen-szqx-d01-a.ops.szqx.com/Radar/CAPPI/GD/${date}/AWS_GD_CAPPI_${fileDate}_${hight}.png"
				+ "?Expires=1563955203&OSSAccessKeyId=JEYGTdPZP4m6eZvD&Signature=C5paOD4WkyplbQPIoYKk1URTxx0%3D";
		StrSubstitutor ssub=new StrSubstitutor(urlValuesMap);
		String replace = ssub.replace(url);
		System.out.println(replace);

		
	}
	
}
